<!DOCTYPE html>
<html>
  <body>
    <input type="file" id="fileInput">
    <button type="button" onclick="uploadFile()">Upload</button>

    <script>
      function uploadFile() {
        const fileInput = document.getElementById('fileInput');
        const clipboardName = 'yyg';

        const file = fileInput.files[0];
        const url = 'http://localhost:8080/clipboard/uploadFile';
      

        const formData = new FormData();
        formData.append('clipboardName', clipboardName);
        formData.append('multipartFile', file);

        fetch(url, {
          method: 'POST',
          body: formData
        })
        .then(response => {
          if (response.ok) {
            console.log('File uploaded successfully!');
          } else {
            console.error('File upload failed.');
          }
        })
        .catch(error => {
          console.error('An error occurred:', error);
        });
      }
    </script>
  </body>
</html>